﻿package blob.levelstates
{
    import blob.*;
    import org.flixel.*;

    public class WinState extends FlxState
    {
        private var WinMusic:Class;

        public function WinState()
        {
            this.WinMusic = WinState_WinMusic;
            FlxG.bgColor = 4287137928;
            var _loc_1:* = new FlxText(50, 200, 700);
            var _loc_2:String = "Congratulations! You have completed Blob! But can you get three stars on every level?";
            var _loc_3:String = "Amazing!! You have achieved three stars on every level! You are the Blob master!!!";
            var _loc_4:Boolean = true;
            var _loc_5:int = 1;
            while (_loc_5 < FlxG.levels.length)
            {
                
                if (FlxG.levels[_loc_5] < 3)
                {
                    _loc_4 = false;
                    break;
                }
                _loc_5++;
            }
            if (_loc_4)
            {
                _loc_1.text = _loc_3;
            }
            else
            {
                _loc_1.text = _loc_2;
            }
            var _loc_6:* = new FlxText(100, 400, 600, "Stay tuned as we continue to improve our game (and maybe even add some more levels)!");
            var _loc_7:* = new FlxText(150, 500, 500, "Press any key to return to the level select menu");
            _loc_1.setFormat(null, 20);
            _loc_6.setFormat(null, 18);
            _loc_7.setFormat(null, 14);
            add(_loc_1);
            add(_loc_6);
            add(_loc_7);
            return;
        }// end function

        override public function create() : void
        {
            super.create();
            var _loc_1:* = FlxG.play(this.WinMusic, 0.5, true, true);
            _loc_1.fadeIn(0.5);
            return;
        }// end function

        override public function update() : void
        {
            if (FlxG.keys.any())
            {
                FlxG.switchState(new GameMenu());
                this.kill();
            }
            return;
        }// end function

    }
}
